<template>
	<div>
    <el-divider>
      <el-icon>属性配置</el-icon>
    </el-divider>
    <zh-form label-position="top" :model="_value" :span="24">
      <zh-form-switch  prop="required" label="是否必填" v-model="_value.required"> </zh-form-switch>
      <zh-form-switch prop="disabled" label="是否禁用" v-model="_value.disabled"> </zh-form-switch>
      <zh-form-switch prop="butttonFlag" label="是否按钮样式" v-model="_value.butttonFlag"> </zh-form-switch>
      <zh-form-switch prop="border" label="是否显示边框" v-model="_value.border"> </zh-form-switch>
      <zh-col>
        <el-tabs
          v-model="state.activeName"
          type="card"
          @tab-change="handleChange"
        >
          <el-tab-pane label="静态数据" name="1">
            <zh-table :height="300" type="default" :columns="state.tableColumn" :data="_value.options" :rowConfig="{keyField:'index'}" :edit-config="{trigger: 'click', mode: 'row', showStatus: true}">
              <template #dictKey_edit="{ row }">
                <zh-input v-model="row.dictKey"></zh-input>
              </template>
              <template #dictValue_edit="{ row }">
                <zh-input v-model="row.dictValue"></zh-input>
              </template>
              <template #operate_default="{ row }">
                <zh-button type="danger" link buttonType="del" @click="delClick(row)"></zh-button>
              </template>
            </zh-table>
            <zh-button  link buttonType="add" @click="add">添加</zh-button>
          </el-tab-pane>
          <el-tab-pane label="动态数据" name="2">
            <zh-form-input prop="dictField" label="数据字典字段" v-model="_value.dictField"></zh-form-input>
            <zh-form-input prop="funcCode" label="功能编号" v-model="_value.funcCode"></zh-form-input>
            <zh-form-input prop="url" label="接口url" v-model="_value.url"></zh-form-input>
            <zh-form-input prop="searchParams" type="textarea" :row="3" label="查询参数json" v-model="_value.searchParams"></zh-form-input>
            <zh-form-input prop="searchField" label="查询主字段" v-model="_value.searchField"></zh-form-input>
          </el-tab-pane>
        </el-tabs>
      </zh-col>
    </zh-form>
  </div>
</template>
<script lang="ts" setup name="CheckboxSetting">
const emits = defineEmits(['update:modelValue']);
//------------------接收传入参数(组件)-------------------
const props = defineProps({
	modelValue: Object,
});
//------------------定义子组件---------------------------

//------------------内部变量定义-------------------------
let _value = ref(Object.assign({fcDragTag:'input'},props.modelValue || {}));
//------------------定义调用方法-------------------------

//------------------初始化------------------------------
onMounted(() => {});
//------------设置给父组件调用的数据/方法(组件)-----------
watch(
	() => props.modelValue,
	(val) => {
		_value.value = Object.assign({fcDragTag:'input'},val || {});
	},
	{
		deep: true,
	}
);
watch(
	() => _value.value,
	(val) => {
		console.log(val);
		emits('update:modelValue', val);
	},
	{
		deep: true,
	}
);

</script>
<style lang="scss" scoped></style>